﻿
@{
    ViewBag.Title = "SuiShouPai";
}

<h2>SuiShouPai</h2>

<link href="~/css/dropload.css" rel="stylesheet" />
<link href="~/css/swiper.min.css" rel="stylesheet" />
<link href="~/css/common.css" rel="stylesheet" />
<style>
    .swiper-container {
        position: fixed;
        width: 100%;
        height: 2rem;
        background-color: #eee;
        z-index: 99999;
        top: 3.2rem;
    }

    .swiper-slide {
        text-align: center;
        font-size: 18px;
        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
    }

    .swiper-xlbtn {
        position: absolute;
        margin-top: -2rem;
        z-index: 999999;
        width: 2rem;
        height: 2rem;
        background-color: #eee;
        right: 0;
        filter: alpha(opacity=50);
        -moz-opacity: 0.5;
        -khtml-opacity: 0.5;
        opacity: 0.9;
    }

    .swiper-slide a {
        color: #212121;
    }

    .current {
        color: #ed4242;
    }

    .aui-slide-page-wrap {
        z-index: 2;
    }
</style>

<header class="aui-bar aui-bar-nav" id="aui-header">
    <div class="aui-title">随手拍</div>
    <a href="@Url.Action("Search")" class="aui-pull-right aui-btn aui-btn-outlined"> <span class="aui-iconfont aui-icon-search"></span> </a>
</header>

<!--导航Start-->
<div class="swiper-container">
    <div class="swiper-wrapper">

    </div>
    <div class="swiper-xlbtn">
        <img src="~/image/xiala000.png" style="margin: 0.7rem 0 0 0.5rem;" />
    </div>
</div>
<!--导航End-->
<!--列表开始-->
<div class="aui-content aui-margin-b-15" style="margin-top:3.72rem;">
    <ul class="aui-list aui-list-in">
        <li class="aui-list-header" style="font-size:1rem;">
            随手拍
        </li>
        <li class="aui-list-item" onclick="return locationUrl('@Url.Action("MassesVoice")')">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title">群众心声</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title">会议纪要</div>
            </div>
        </li>
        <li class="aui-list-item" onclick="return locationUrl('@Url.Action("MessageBoard")')">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-title">留言板</div>
            </div>
        </li>
    </ul>
</div>

<!--列表结束-->
<!--加载动画Start-->
<div id="loading">
    <div class="loading">
        <img src="~/image/loading.gif" />
    </div>
</div>
<!--加载动画End-->

<script src="~/Scripts/swiper.min.js"></script>
<script src="~/Scripts/commonJS.js"></script>

<script type="text/javascript">

    var locationUrl=function(url){
        window.location.href=url;
    };

    $(function () {

        //获取菜单ID
        var ID = (getUrlParam('ID') == null) ? "" : getUrlParam('ID');

        //加载顶部菜单
        $.ajax({
            url: "http://shtdj.shanhaitian.gov.cn/AppInterface/api/Frame/GetMenu",
            contentType: "application/json",
            type: "POST",
            async: true,
            data: JSON.stringify({ ID: 'HomePage', IsChild: 'false' }),
            dataType: "json",
            success: function (data, status) {
                var dd = eval(data.result);
                var result = '';
                for (var i = 0; i < dd.length; i++) {

                    if (ID == "" && i == 0) {
                        //默认第一个菜单被选中
                        result += '<div class="swiper-slide"><a href="' + dd[i].NavigateUrl + '" style="color:#ed4242;" >'
                    }
                    else if (ID == dd[i].ID) {
                        result += '<div class="swiper-slide"><a href="' + dd[i].NavigateUrl + '" style="color:#ed4242;" >'
                    }
                    else {
                        result += '<div class="swiper-slide"><a href="' + dd[i].NavigateUrl + '">'
                    }

                    result += dd[i].Name + '</a></div>';
                }
                result += '<div class="swiper-slide"></div>';
                $(".swiper-wrapper").html(result);

                //导航滑动效果
                var swiper = new Swiper('.swiper-container', {
                    slidesPerView: 4,
                    paginationClickable: true,
                    spaceBetween: 0,
                    freeMode: true
                });
            },
            error: function (xhr, textStatus) {
                console.log('错误')
                console.log(xhr)
                console.log(textStatus)
            }
        });

        $.ajax({
            url: "@Url.Action("GetSession")",
            type: "POST",
        contentType: 'application/json',
        data: {},
        dataType: "json",
        success: function (data, status) {
            var dd = eval(data);

            if (dd.code == "201") {
                //对话框
                dialog.alert({
                    title: "消息提示",
                    msg: dd.msg,
                    buttons: ['确定']
                }, function (ret) {
                    console.log(ret);
                    window.location.href = "@Url.Action("Login")";
                });
            } else {
                var cc = dd.result;
                //给隐藏域赋值
                $("#hidCreateBy").val(cc.UserId);

                //获取个人信息
                $.ajax({
                    url: "http://shtdj.shanhaitian.gov.cn/AppInterface/api/User/GetPartyBuildingUserModel",
                    type: "POST",
                    contentType: 'application/json',
                    async: true,
                    data: JSON.stringify({ UserId: cc.UserId }),
                    dataType: "json",
                    success: function (data, status) {
                        var dd = eval(data);
                        if (dd.code == "201") {
                            //对话框
                            dialog.alert({
                                title: "消息提示",
                                msg: dd.msg,
                                buttons: ['确定']
                            }, function (ret) {
                                console.log(ret);
                                window.location.href = "@Url.Action("Login")";
                            });
                        }

                        //隐藏加载动画
                        $("#loading").hide();
                    },
                    error: function (xhr, textStatus) {
                        console.log('错误')
                        console.log(xhr)
                        console.log(textStatus)
                    }
                });
            }

        },
        error: function (xhr, textStatus) {
            console.log('错误')
            console.log(xhr)
            console.log(textStatus)
        }
    });

        //隐藏加载动画
        $("#loading").hide();
        //跳转到全部导航页面
        $(".swiper-xlbtn").click(function () {
            window.location.href = '@Url.Action("Menu")';
        });
    });
</script>
